import { fileURLToPath, URL } from 'node:url'

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

// https://vitejs.dev/config/
export default defineConfig({
  server: {
    host: '0.0.0.0',
    proxy: {
      // 选项写法
      '/api': {
        target: 'http://47.94.148.165:3001',
        changeOrigin: true,
        // 注释掉这行可以在url地址中不写
        // rewrite: (path) => path.replace(/^\/api/, '')
      },
    },
  },
  plugins: [vue()],
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url)) 
    }
  }
})
